<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/9/16
 * Time: 10:59
 */

namespace app\common\validate;


use think\Validate;

class SysMenu extends Validate
{
    protected $rule = [ // 定义验证规则
        'menu_id|菜单ID' => 'require|number',
        'parent_id|父ID' => 'require|number',
        'menu_name|菜单名称' => 'require|unique:SysMenu,menu_name^parent_id',
        'menu_url|菜单路径' => 'require',
        'sort_number|排序序号' => 'require',
    ];

    protected $message = [ // 定义验证提示

    ];

    protected $scene = [ // 定义验证场景
        'add' => ['menu_name','menu_url','sort_number'],
        'update' => ['menu_id','menu_name.unique'=>'SysMenu,menu_name^parent_id^menu_id','menu_url','sort_number'],
    ];
}